home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1985 November
/
Ahoy_Magazine_85-11_1985_Double_L.d64
/
file scout v0619
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
5KB
|
189 lines
1 rem *********************************
2 rem * *
3 rem * file scout v0619/85 *
4 rem * (rv 0316/84) *
5 rem * *
6 rem *********************************
7 rem
10 poke 53280,12:poke 53281,0 :print chr$(147)chr$(154);
16 h$="0123456789abcdef"
20 goto 1000
50 rem locate
51 poke 214,rw:poke 211,cl:sys 58640:return
60 rem set row, columns for scan
61 dim rw(35),cl(35)
62 for i=0 to 16:rw(i)=i+6:cl(i)=4:next i
63 for i=17 to 34:rw(i)=(i+6)-17:cl(i)=19:next i
65 return
99 :
100 rem ** collect all the active files and their first track & sectors **
101 rw=5:cl=6 :gosub 50:print "reading directory";
105 open 15,8,15,"u;"
110 n1=144:dim f$(n1),t(n1),s(n1),b(n1),ft$(n1)
115 open 2,8,2,"#2"
120 td=18:ts=1:nf=0
130 print#15,"u1:2,8,"td,ts
140 get#2,a$:td=asc(a$+chr$(0)):get#2,a$:ts=asc(a$+chr$(0))
145 for k=0 to 7
150 get#2,a$:if asc(a$+chr$(0))=0 then gosub 300:goto 230
151 a=asc(a$):if (a and 64)=0 then ft$(nf)="[160]":goto 153
152 ft$(nf)=">"
153 a=(a and(255-64))
155 if a=129 then ft$(nf)=ft$(nf)+"seq"
156 if a=130 then ft$(nf)=ft$(nf)+"prg"
157 if a=131 then ft$(nf)=ft$(nf)+"usr"
160 get#2,a$:get#2,b$:t(nf)=asc(a$+chr$(0)):s(nf)=asc(b$+chr$(0))
165 for j=0 to 15:get#2,a$
170 if a$=chr$(160) then goto 190
180 f$(nf)=f$(nf)+a$
190 next j
199 :
200 for j=0 to 8:get#2,a$:next j
210 get#2,a$:get#2,b$:b(nf)=asc(a$+chr$(0))+asc(b$+chr$(0))*256:ba=ba+b(nf)
224 nf=nf+1
225 get#2,a$:get#2,a$
230 next k
240 if td<>18 then goto 245
241 if ts<1 or ts>19 then goto 245
242 goto 130
245 if nf=0 then print"no files":end
246 close2:bf=664-ba:return
299 :
300 for j=0 to 30
310 get#2,a$:nextj
320 return
399 :
400 rem scan for t & s
405 rw=24:cl=1:gosub 50:print bl$;
410 rw=23:cl=2:gosub 50:f$="":k1=-1:print chr$(158);:input "file name";f$
411 if f$="" then rw=23:cl=1:print bl$;:return
412 ln=len(f$):if right$(f$,1)="*" then ln=len(f$)-1:f$=left$(f$,ln)
420 for k=0 to nf
422 if k1<>-1 then goto 430
425 if f$=left$(f$(k),ln) then k1=k
430 next k
431 ifk1=-1thenprint " not found";:for k=0to2000:nextk:printchr$(154);:return
435 tr=t(k1):sc=s(k1)
440 bc=0:c=0:t4$="trk sec"
445 print#15,"i0:":close2: open 2,8,2,"#2"
450 print hd$;:rw=2:cl=1:gosub 50:print f$(k1);
455 rw=4:cl=6:gosub 50:print t4$;
460 rw=rw(c):cl=cl(c):gosub 50:print bc;tr;sc
465 gosub 590:if tr=0 then goto 480
470 bc=bc+1:c=c+1
475 if c<34 then goto 460
480 rw=24:cl=10:gosub 50:print chr$(5) "next print return ";
482 gosub 700:print a$chr$(158);
490 if a$="n" and bc<b(k1)-1 then c=0:goto 450
492 if a$="n" and bc=b(k1)-1 then goto 435
495 if a$="p" then gosub 500:goto 435
496 if a$="r" then close 2:print chr$(154);:return
497 goto 482
499 :
500 rem print out for t & s
505 open 4,4:bc=0
510 print#4,f$(k1)
515 tr=t(k1):sc=s(k1)
520 print#4,chr$(13)chr$(13)t4$chr$(13)chr$(13)
525 print#4,bc,tr,sc
530 gosub 590:bc=bc+1
535 if tr=0 then print#4:close4:return
540 goto 525
590 print#15,"u1:2,8",tr,sc
595 get#2,a$:tr=asc(a$+chr$(0))
596 get#2,a$:sc=asc(a$+chr$(0))
597 return
599 :
600 rem ** get load addr prg files **
605 dim la(n1),lh$(n1)
610 open 2,8,2,"#2"
620 for i=0 to nf-1
625 if right$(ft$(i),3)<>"prg" then la(i)=-1:goto 650
630 print#15,"u1:2,8,"t(i),s(i)
632 print#15,"b-p:"2,0
635 get#2,a$:get#2,a$:get#2,a$:get#2,b$
636 a=asc(a$+chr$(0)):b=asc(b$+chr$(0))
640 la(i)=a +b*256
641 bh=int(b/16):bl=b-(bh*16)
642 ah=int(a/16):al=a-(ah*16)
643 lh$(i)=mid$(h$,bh+1,1)+mid$(h$,bl+1,1)
644 lh$(i)="$"+lh$(i)+mid$(h$,ah+1,1)+mid$(h$,al+1,1)
650 next i
655 close 2:return
699 :
700 rem get char from kb, with cursor
705 poke 198,0:poke 204,0
710 get a$:poke 207,0:if a$="" then goto 710
715 poke 204,1:print " "chr$(157);:return
725 close15:open 15,8,15,"i0:"
730 input#15,a$,b$,c$,d$:close15
735 if a$="00" then return
740 print:print:print"disk error":stop
749 :
750 rem get disk name & id
760 open 15,8,15,"u;"
770 open 2,8,2,"#2"
775 td=18:ts=0:print#15,"u1:2,8,"td,ts
780 print#15,"m-r"chr$(144)chr$(5)chr$(20)
782 for i=0 to 19:get#15,a$:dn$=dn$+a$:next i
795 close2:close15:return
799 :
800 t1$=dn$+nf$
801 t2$="blocks alloc:[160]"+str$(ba)+" blocks free: "+str$(bf)+" "
802 t3$="file type trk sec blk addr.d addr.h":s1$=" "
805 open 4,4:cmd 4
808 print s1$t1$:print s1$t2$:print:print s1$t3$:print
810 for k=0 to nf-1
820 print s1$f$(k);:for j=0to16-len(f$(k)):print" ";:next j:print ft$(k);
829 sp$=" "
830 a$=str$(t(k)):a$=a$+right$(sp$,3-len(a$))
831 b$=str$(s(k)):b$=b$+right$(sp$,3-len(b$))
832 c$=str$(b(k)):c$=c$+right$(sp$,4-len(c$))
840 print a$spc(1)b$spc(1)c$spc(1);:if la(k)<0 then print sp$;:goto 845
841 d$=str$(la(k)):d$=d$+right$(sp$,6-len(d$)):print d$spc(1)
845 print lh$(k)
850 next k
860 print#4,chr$(13):print#4:close4:return
899 :
1000 rem ** main routine **
1001 r0$=chr$(146):r9$=chr$(18):cl$=chr$(147)
1002 bl$=" "
1003 hd$=cl$+r9$+" file scout v0619/85 "+r0$
1004 print hd$;:gosub 60
1005 rw=3:cl=1:gosub 50:print "insert disk and hit a key ";
1006 gosub 700:gosub 725:gosub 750
1010 gosub 100:gosub 600
1015 print
1400 nf$=str$(nf):l=len(nf$)
1401 fl$=right$(bl$,9-l)
1405 nf$= " # files : "+nf$+fl$
1410 th$=cl$+r9$+dn$+nf$
1501 sp$=" ":l=len(str$(ba))+len(str$(bf)):fl$=right$(sp$,14-l)
1502 tj$=r9$+"blocks alloc:"+str$(ba)+" blocks free:"+str$(bf)+fl$
1503 tl$=r9$+"file type trk sec blk addr "+r0$:i=0
1505 print th$;:print tj$:print tl$:print
1520 print f$(i);:for j=0to16-len(f$(i)):print" ";:next j:print ft$(i);
1529 sp$=" "
1530 a$=str$(t(i)):a$=a$+right$(sp$,3-len(a$))
1531 b$=str$(s(i)):b$=b$+right$(sp$,3-len(b$))
1532 c$=str$(b(i)):c$=c$+right$(sp$,4-len(c$))
1540 print a$spc(1)b$spc(1)c$;:if la(i)<0 then goto 1545
1541 print str$(la(i))
1545 print spc(34)lh$(i)
1546 i=i+1:if i=nf then goto 1548
1547 if i/8-int(i/8)<>0 then goto 1520
1548 rw=24:cl=5:gosub 50:print chr$(5)" next scout print boot quit?[160]";
1549 gosub 700:print a$;:print chr$(154);
1550 if a$="p" then gosub 800:print chr$(20);:goto 1548
1555 if a$="s" then gosub 400:goto 1580
1560 if a$="q" then stop
1565 if a$="b" then clr:goto 10
1570 if a$<>"n" then goto 1548
1575 if i<nf then goto 1505
1580 i=0:goto 1505
5999 :
6000 close15:open 15,8,15,"i0:":print#15,"s0:file scout v0619":close15
6005 save "file scout v0619",8:stop
6100 close15:open 15,8,15:input#15,a$,b$,c$,d$:close15
6101 print a$"[160]"b$"[160]"c$"[160]"d$:stop